<ix-modal-header
  [requiredRoles]="requiredRoles"
  [title]="'System Security' | translate"
></ix-modal-header>

<mat-card class="card">
  <mat-card-content>
    <form class="ix-form-container" [formGroup]="form" (submit)="onSubmit()">
      <ix-slide-toggle
        formControlName="enable_fips"
        color="primary"
        [label]="'Enable FIPS' | translate"
        [tooltip]="'Enforce the use of FIPS 140-2 compliant algorithms' | translate"
      ></ix-slide-toggle>

      <ix-slide-toggle
        formControlName="enable_gpos_stig"
        color="primary"
        [label]="'Enable General Purpose OS STIG compatibility mode' | translate"
        [tooltip]="'Enable this mode to enhance system security to meet US federal government security requirements. Note that enabling STIG mode will restrict some functionality.' | translate"
      ></ix-slide-toggle>

      <mat-hint>{{ 'Global Two-Factor Authentication must be enabled to activate this feature.' | translate }}</mat-hint>
      <mat-hint>{{ 'Restart is required after changing these settings.' | translate }}</mat-hint>

      <ix-input
        formControlName="min_password_age"
        type="number"
        [label]="'Min Password Age' | translate"
        [tooltip]="'Minimum number of days a password must be used before it can be changed.' | translate"
      ></ix-input>

      <ix-input
        formControlName="max_password_age"
        type="number"
        [label]="'Max Password Age' | translate"
        [tooltip]="'Maximum number of days a password can be used before it must be changed.' | translate"
      ></ix-input>

      <ix-select
        formControlName="password_complexity_ruleset"
        [options]="complexityRulesetLabels$"
        [multiple]="true"
        [label]="'Password Complexity Ruleset' | translate"
        [tooltip]="'Password complexity ruleset. Choose between Upper, Lower, Number and Special complexity levels.' | translate"
      ></ix-select>

      <ix-input
        formControlName="min_password_length"
        type="number"
        [label]="'Min Password Length' | translate"
        [tooltip]="'Minimum number of characters in a password. Must be at least 8 characters.' | translate"
      ></ix-input>

      <ix-input
        formControlName="password_history_length"
        type="number"
        [label]="'Password History Length' | translate"
        [tooltip]="'Number of previous passwords to remember. Must be between 1 and 10.' | translate"
      ></ix-input>

      <div class="form-actions">
        <button
          *ixRequiresRoles="requiredRoles"
          mat-button
          type="submit"
          color="primary"
          ixTest="save"
          [disabled]="!form.valid"
        >
          {{ 'Save' | translate }}
        </button>
      </div>
    </form>
  </mat-card-content>
</mat-card>
